package com.lighting.lightingservice.controller;

import com.aliyun.oss.model.OSSObjectSummary;
import com.lighting.lightingservice.dto.Page;
import com.lighting.lightingservice.service.DataService;
import com.lighting.lightingservice.utils.AliOSSUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

@RestController
public class DataController {

    @Autowired
    private DataService dataService;

    @RequestMapping("/data")
    @ResponseBody
    @CrossOrigin
    Page forData(){

        return  dataService.getPageByDB();
    }

    @RequestMapping("/sliderTitleUp1")
    @ResponseBody
    @CrossOrigin
    String setDataForSliderTitleUp1(String sliderTitleUp1){
       dataService.setSliderTitleUp1(sliderTitleUp1);
       return sliderTitleUp1;
    }

    @RequestMapping("/sliderTitleDown1")
    @ResponseBody
    @CrossOrigin
    String setDataForSliderTitleDown1(String sliderTitleDown1){
        dataService.setSliderTitleDown1(sliderTitleDown1);
        return sliderTitleDown1;
    }

    @RequestMapping("/sliderTitleUp2")
    @ResponseBody
    @CrossOrigin
    String setDataForSliderTitleUp2(String sliderTitleUp2){
        dataService.setSliderTitleUp2(sliderTitleUp2);
        return sliderTitleUp2;
    }

    @RequestMapping("/sliderTitleDown2")
    @ResponseBody
    @CrossOrigin
    String setDataForSliderTitleDown2(String sliderTitleDown2){
        dataService.setSliderTitleDown2(sliderTitleDown2);
        return sliderTitleDown2;
    }

    @RequestMapping("/sliderTitleUp3")
    @ResponseBody
    @CrossOrigin
    String setDataForSliderTitleUp3(String sliderTitleUp3){
        dataService.setSliderTitleUp3(sliderTitleUp3);
        return sliderTitleUp3;
    }

    @RequestMapping("/sliderTitleDown3")
    @ResponseBody
    @CrossOrigin
    String setDataForSliderTitleDown3(String sliderTitleDown3){
        dataService.setSliderTitleDown3(sliderTitleDown3);
        return sliderTitleDown3;
    }

    @RequestMapping("/midTitleUp")
    @ResponseBody
    @CrossOrigin
    String setDataForMidTitleUp(String midTitleUp){
        dataService.setMidTitleUp(midTitleUp);
        return midTitleUp;
    }

    @RequestMapping("/midTitleDown")
    @ResponseBody
    @CrossOrigin
    String setDataForMidTitleDown(String midTitleDown){
        dataService.setMidTitleDown(midTitleDown);
        return midTitleDown;
    }


    @RequestMapping("/blockTitle1")
    @ResponseBody
    @CrossOrigin
    String setDataForBlockTitle1(String blockTitle1){
        dataService.setBlockTitle1(blockTitle1);
        return blockTitle1;
    }

    @RequestMapping("/blockTitle2")
    @ResponseBody
    @CrossOrigin
    String setDataForBlockTitle2(String blockTitle2){
        dataService.setBlockTitle2(blockTitle2);
        return blockTitle2;
    }

    @RequestMapping("/blockTitle3")
    @ResponseBody
    @CrossOrigin
    String setDataForBlockTitle3(String blockTitle3){
        dataService.setBlockTitle3(blockTitle3);
        return blockTitle3;
    }

    @RequestMapping("/blockTitle4")
    @ResponseBody
    @CrossOrigin
    String setDataForBlockTitle4(String blockTitle4){
        dataService.setBlockTitle4(blockTitle4);
        return blockTitle4;
    }

    @RequestMapping("/getOSS")
    @ResponseBody
    @CrossOrigin
    String[] getOSSData() {

        return dataService.getAllOSS();
    }

    //************测试*****************



}
